package 预科0104StudentSystem_Q1;
//学生类
public class Student {
	//学号 0~999999
	private int id;
	//姓名
	private String name;
	//年龄
	private int age;
	
	public Student() {
	}
	public Student(int id, String name, int age) throws StudentIdException, StudentAgeException {
		super();
		setId(id);
		setName(name);
		setAge(age);
	}
	@Override
	public String toString() {
		return "Student [id=" + id + ", name=" + name + ", age=" + age + "]";
	}
	public int getId() {
		return id;
	}
	public void setId(int id) throws StudentIdException {
		if(id<0 || id>999999) {
			throw new StudentIdException();
		}else {
			this.id = id;
		}
		
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public int getAge() {
		return age;
	}
	public void setAge(int age) throws StudentAgeException {
		if(age<0 || age>150) {
			throw new StudentAgeException();
		}else {
			this.age = age;
		}
	}



}
